package com.github.boluo1230.wechat.feign;

import com.github.boluo1230.wechat.entity.message.WxCustomMsg;
import com.github.boluo1230.wechat.entity.vo.WxResponse;
import com.github.boluo1230.wechat.feign.fallback.MessageFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(url = "https://api.weixin.qq.com",
        value = "weixin-api-message",
        fallbackFactory = MessageFallback.class)
public interface WxMessageAPI {
    /**
     * 发送客服消息
     */
    @PostMapping("/cgi-bin/message/custom/send")
    WxResponse sendCustomMessage(@RequestParam(value = "access_token") String accessToken,
                                 @RequestBody WxCustomMsg wxCustomMsg);

    /**
     * 发送模服消息
     */
    @PostMapping("/cgi-bin/message/template/send")
    WxResponse sendTemplateMessage(@RequestParam(value = "access_token") String accessToken,
                                   @RequestBody WxCustomMsg wxCustomMsg);
}
